//两个字符串的最大相同子串长度
#include <stdio.h>
#include <string.h>

int main() 
{
    char arr1[151] = {0};
    char arr2[151] = {0};
    scanf("%s", arr1);
    scanf("%s", arr2);
    int len1 = strlen(arr1);
    int len2 = strlen(arr2);
    int dp[len1+1][len2+1];
    int maxLen = 0;

    memset(dp, 0, sizeof(dp));
    for(int i = 1; i <= len1; i++)
    {
        for(int j = 1; j <= len2; j++)
        {
            dp[i][j] = arr1[i-1] == arr2[j-1] ? dp[i-1][j-1] + 1 : 0;
            maxLen = maxLen > dp[i][j] ? maxLen : dp[i][j];
        }
    }

    printf("%d\n", maxLen);
    
    return 0;
}